from selenium.webdriver.common.by import By
from selenium.webdriver.edge.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.microsoft import EdgeChromiumDriverManager
from selenium import webdriver
import time  # 需要导入time模块

# 使用webdriver-manager安装Edge驱动程序
ChromeIns = ChromeDriverManager().install()

# 创建Edge驱动对象
driver = webdriver.Chrome(service=Service(ChromeIns))  # 注意这里改为webdriver.Edge

# 打开相应URL
driver.get("http://baidu.com")
time.sleep(3)

# # 找到对应的元素
# driver.find_element(By.CSS_SELECTOR, "#chat-input").send_keys("我是自动化，嘿嘿嘿")
# time.sleep(3)

# 点击搜索按钮
ret=driver.find_elements(By.CSS_SELECTOR, "#hotsearch-content-wrapper > li")
for i in ret:
    print(i.text)
time.sleep(3)

# 关闭浏览器
driver.quit()